<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1 id="t"></h1>
<script>
    var hh = document.getElementById('t');
    //hh.innerHTML = 'helloworld';
    //document.write('helloworld');
    function getTimer(){
        var d = new Date();
        var y = d.getFullYear();
        var m = d.getMonth()+1;
        if(m<10) m = '0'+m;
        var dd = d.getDate();
        if(dd<10) dd = '0'+dd;

        var hh = d.getHours();
        if(hh<10) hh = '0'+hh;

        var mm = d.getMinutes();
        if(mm<10) mm = '0'+mm;

        var ss = d.getSeconds();
        if(ss<10) ss = '0'+ss;
        return y+"年"+m+"月"+dd+"日 "+hh+":"+mm+":"+ss+" 星期"+"日一二三四五六".charAt(d.getDay());
    }
    function aa(){
        //document.write(getTimer());
        document.getElementById('t').innerHTML = getTimer();
    }
    //aa();
    //setInterval(aa,1000);
</script>
</body>
</html>